package clasesweb;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.*;
import javax.servlet.http.*;

public class ValidarUsuario extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";

    public void init(ServletConfig config) throws ServletException {
        super.init(config);
    }

    public void doGet(HttpServletRequest request, 
                      HttpServletResponse response) throws ServletException, IOException {
        
        String User, Clave;
        
        User = request.getParameter("txtUser");
        Clave = request.getParameter("txtClave");
        
        if (User.equals("jramirez") && Clave.equals("1234")){
            HttpSession sesion = request.getSession(true);
            sesion.setAttribute("usuario", User);
            
            response.sendRedirect("Bienvenido.jsp");
        }else{
            response.sendRedirect("Error.jsp");
        }
    }
}
